var mysql = require("mysql");

var writeDb = {
  host: "47.103.36.143",
  port: 3310,
  user: "root",
  password: "123456",
  database: "wx_one"
};

var readDb = {
  host: "47.103.36.143",
  port: 3311,
  user: "root",
  password: "123456",
  database: "wx_one"
};

var mycatDb = {
  host: "localhost",
  port: 8066,
  user: "root",
  password: "123456",
  database: "wx_one"
};

var connection = mysql.createConnection(mycatDb);

connection.connect();

var addSql = "INSERT INTO user(id,name) VALUES(?,?)";
var addSqlParams = [new Date().getTime().toString(),'王孟贵'];

connection.query(addSql, addSqlParams, function(err, result) {
  if (err) {
    console.log("[INSERT ERROR] - ", err.message);
    return;
  }
  console.log(result, "insert");
});

connection.end();
